import { Button, LineEdit, HorizontalBox } from "std-widgets.slint";
export component LoginPage {
    callback login(string, string);
    property <string> username;
    property <string> password;
    VerticalLayout {
        spacing: 16px;
        padding: 20px;
        Text {
            text: "欢迎使用";
            font-size: 36px;
            font-weight: 700;
            color: #333;
            horizontal-alignment: center;
        }

        GridLayout {
            spacing: 16px;
            max-height: 40px;
            Row {
                Text {
                    vertical-alignment: center;
                    text: "账号";
                }

                LineEdit {
                    placeholder-text: "用户名";
                    text <=> username;
                }
            }

            Row {
                Text {
                    vertical-alignment: center;
                    text: "密码";
                }

                LineEdit {
                    placeholder-text: "密码";
                    input-type: InputType.password;
                    text <=> password;
                }
            }
        }

        HorizontalBox {
            alignment: center;
            Button {
                text: "登录";
                width: 80px;
                max-height: 20px;
                clicked => {
                    root.login(username, password)
                }
            }
        }
    }
}